import numpy as np

def createB(n,input):#依次输入比较矩阵右上角数据，完成比较矩阵
    m = 0   #控制输入在对应的矩阵位置上
    matrix = np.zeros((n, n))
    # 创建n个部件的第一个比较矩阵
    for i in range(n):
        matrix[i][i] = 1
    for i in range(n - 1):
        for j in range(i + 1, n):
            matrix[i][j] = input[m]     #"请输入{}{}的值:".format(i + 1, j + 1)
            m += 1

    for j in range(n - 1):
        for i in range(j + 1, n):
            matrix[i][j] = 1 / matrix[j][i]
    matrix = matrix.tolist()
    return matrix

n = {{n}}   #“3”修改为选取部件数量
input1 = {{input1}}    #输入向量的个数为：   int(n*(n-1)/2)
matrix1 = createB(n,input1)
#第二个例子
# m = 5
# input2 = [2,2,3,4,5,6,7,8,9,3]
# matrix2 = createB(m,input2)
print({"code": 1, "msg": "", "matrix1": matrix1}, end = "")
#print(matrix1)
# print(matrix2)